package cn.kb05;

import java.util.Scanner;

/*
 * @author:LGQ
 * @Description: 寻找相同字符
 * @date: 2019/12/2
 * */
public class Home1 {
    static int count=0;
    public static void main(String[] args) {

        Scanner sc =new Scanner(System.in);
        System.out.println("请输入一首你喜欢的小诗：");
        String input = sc.next();
        System.out.print("请输入一个关键字：");
        String zi = sc.next();
         char[] input1=input.toCharArray();
        System.out.println(input1);
        for (int i=0;i<input1.length;i++){
              if(String.valueOf(input1[i]).equals(zi)){
                 count++;
              }
           }
        System.out.println(input+"含有"+count+"个"+zi);
}
}
